package com.geekaca.web.service;

import com.geekaca.web.mapper.BrandTypeMapper;
import com.geekaca.web.pojo.BrandType;
import com.geekaca.web.utils.SqlSessionFactoryUtils;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;

import java.util.List;

public class TypeService {
    private SqlSessionFactory sqlSessionFactory = SqlSessionFactoryUtils.getSqlSessionFactory();

    public List<BrandType> selectAll() {
        SqlSession sqlSession = sqlSessionFactory.openSession();
        BrandTypeMapper brandTypeMapper = sqlSession.getMapper(BrandTypeMapper.class);
        List<BrandType> brandTypes = brandTypeMapper.selectAll();
        sqlSession.close();
        return brandTypes;
    }
}
